package cn.kevinking.auth.util;

import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

/**
 * redis ops tools
 *
 * @author kevinking
 * @since 29 Jun 2025
 */
@Component
public class RedisCache {

	private static RedisCache INSTANCE;

	@Autowired
	private StringRedisTemplate redisTemplate;

	public static StringRedisTemplate getRedisTemplate() {
		return INSTANCE.redisTemplate;
	}

	@PostConstruct
	public void init() {
		INSTANCE = this;
		INSTANCE.redisTemplate = this.redisTemplate;
	}
}
